import request from '@/utils/request'
import { microservices } from '@/utils'

export function getCurrTreeAll () {
  return request({
    url: `${microservices.pmsSys}/SysOrg/currTreeAll`,
    method: 'get'
  })
}

export function putSysOrg (data) {
  return request({
    url: `${microservices.pmsSys}/SysOrg`,
    data,
    method: 'put'
  })
}

export function deleteSysOrg (id) {
  return request({
    url: `${microservices.pmsSys}/SysOrg/${id}`,
    method: 'delete'
  })
}

export function getSysOrgDepart (params) {
  let sortStr = params.sortStr
  delete params.sortStr
  return request({
    url: `${microservices.pmsSys}/SysOrgDepart?${sortStr}`,
    params
  })
}

export function putSysOrgDepart (data) {
  return request({
    url: `${microservices.pmsSys}/SysOrgDepart`,
    data,
    method: 'put'
  })
}

export function deleteSysOrgDepart (id) {
  return request({
    url: `${microservices.pmsSys}/SysOrgDepart/${id}`,
    method: 'delete'
  })
}

export function postSysOrgDepart (data) {
  return request({
    url: `${microservices.pmsSys}/SysOrgDepart`,
    data,
    method: 'post'
  })
}

export function postSysOrg (data) {
  return request({
    url: `${microservices.pmsSys}/SysOrg`,
    data,
    method: 'post'
  })
}

export function getSysOrgId (data) {
  return request({
    url: `${microservices.pmsSys}/SysOrg/${data}`
  })
}
